/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package aptech.semester.code.custom.component;

import aptech.semester.code.common.Constants;
import java.awt.Graphics;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.JDesktopPane;

/**
 *
 * @author vi
 */
public class BackgroundImageDesktopPane extends JDesktopPane {

    private static final long serialVersionUID = 1L;

    private Image img;

    public BackgroundImageDesktopPane() {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        URL url = loader.getResource(Constants.PATH_IMAGE + "background1.jpg");
        try {

            img = ImageIO.read(url);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(img, 0, 0, this);
    }
}
